Repository navigation
Use SQL null semantics for DuckDB IN and NOT IN pushdown - #10054
robert3005 wants to merge 3 commits into
Conversation
Merging this PR will regress 11 benchmarks
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | optimize_lookup_predicate[ids=192, shape=in_list] |
51 µs | 75.5 µs | -32.41% |
| ❌ | Simulation | optimize_lookup_predicate[ids=128, shape=in_list] |
51.6 µs | 72.9 µs | -29.18% |
| ❌ | Simulation | optimize_lookup_predicate[ids=64, shape=in_list] |
51.5 µs | 70.3 µs | -26.69% |
| ❌ | Simulation | optimize_lookup_predicate[ids=256, shape=in_list] |
79.6 µs | 105.2 µs | -24.34% |
| ❌ | Simulation | optimize_lookup_predicate[ids=16, shape=in_list] |
52.4 µs | 69.1 µs | -24.15% |
| ❌ | Simulation | take_map[(0.1, 1.0)] |
226.1 µs | 292.1 µs | -22.6% |
| ❌ | Simulation | optimize_lookup_predicate[ids=1, shape=in_list] |
75.3 µs | 89.7 µs | -16.13% |
| ❌ |
Simulation | random_i128[0.01] |
7.2 µs | 8.5 µs | -15.01% |
| ❌ | Simulation | sum_i64 |
194.4 µs | 225.1 µs | -13.62% |
| ❌ | Simulation | sum_v2_i64 |
194.2 µs | 224.8 µs | -13.58% |
| ❌ | WallTime | filter_avx2[64] |
2.1 µs | 2.3 µs | -10.64% |
| ⚡ | Simulation | i64_random_chunked[256] |
13,907.4 µs | 225.7 µs | ×62 |
| ⚡ | Simulation | utf8_random[256] |
12,973.6 µs | 415.1 µs | ×31 |
| ⚡ | Simulation | i64_random[256] |
3,928.8 µs | 169.2 µs | ×23 |
| ⚡ | Simulation | nested_list_random[32] |
6.7 ms | 1 ms | ×6.4 |
| ⚡ | WallTime | filter_avx512[80] |
3.2 µs | 2.3 µs | +42.57% |
| ⚡ | WallTime | filter_avx512[64] |
2.9 µs | 2.2 µs | +33.24% |
| ⚡ | WallTime | bitpack_blocked_compress_avx512 |
5.6 µs | 4.8 µs | +17.07% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing rk/duckdb-list-contains (461e8a7) with develop (751e0af)1
Footnotes
2aaa1b6 to
1b63fd8
Compare
7f7f687 to
29fa2b0
Compare
1b63fd8 to
3151b45
Compare
29fa2b0 to
adc15ee
Compare
adc15ee to
2535299
Compare
3151b45 to
b6ffdda
Compare
2535299 to
cafd7d2
Compare
ed99a18 to
0e3443a
Compare
04bd414 to
459162a
Compare
2242462 to
828a8f7
Compare
c0e6065 to
843d57c
Compare
828a8f7 to
3dd8f74
Compare
| ) { | ||
| let mut children = op.children(); | ||
| return children.next().is_some_and(can_push_expression) | ||
| && children.all(|child| matches!(child.as_class(), Some(BoundConstant(_)))); |
There was a problem hiding this comment.
this seems stricter than before
| TableFilterClass::InFilter(values) => { | ||
| // TODO(ngates): I'm pretty sure we actually need this as ScalarValue with the | ||
| // scope dtype | ||
| let scalars: Vec<_> = values.iter().map(Scalar::try_from).try_collect()?; |
There was a problem hiding this comment.
we should remove this
843d57c to
e4b6598
Compare
3dd8f74 to
2a51612
Compare
2a51612 to
446956a
Compare
e4b6598 to
2a977a1
Compare
2a977a1 to
5b12a0f
Compare
446956a to
6801f5b
Compare
5b12a0f to
757e4da
Compare
Convert both IN table filters and bound membership expressions through in_list, so a null set element leaves nonmatches unknown. Decline nonconstant lists instead of promising conversion and failing later. Add scan-result and EXPLAIN regressions for nullable sets, views, large constant lists, and fallback for nonconstant list elements. Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
757e4da to
461e8a7
Compare
856b420 to
2bda1b5
Compare
Summary
DuckDB membership pushdown used Vortex's default null rules, which can make a nonmatch in
NOT IN (1, NULL)true. Use SQL null semantics so that result remains unknown and the row is excluded.Stacked on #10053; uses SQL null semantics from #10057 and membership optimizations from #10052.
Changes
IN/NOT INexpressions andINtable filters throughin_list.EXPLAINregressions for null elements in either position, nullable needles, negation, scans through views, and a 1,000-element set. Add a nonconstant-list fallback regression.Validation:
cargo clippy -p vortex-duckdb --all-targets --all-features -- -D warningspassed on this branch. Runtime tests were not executed.